// DMPluginWrapper.h

#pragma once

#include "dmalgointerfaces.h"

using namespace System;


#include "DMEnumerationWrappers.h"
#include "DMMiningParameter.h"
#include "DMCustomFunctions.h"

/**********************************************************************
	Custom programming attributes used in the development 
	of managed plugins
**********************************************************************/
namespace Microsoft
{
namespace SqlServer
{
namespace DataMining
{
namespace PluginAlgorithms
{

	// MiningAlgorithmClassAttribute -- makes the metadata class aware of the algorithm 
	// class
	[AttributeUsage(AttributeTargets::Class)]
	public ref class MiningAlgorithmClassAttribute sealed : public System::Attribute 
	{
	private:
		System::Type^	algorithmClass;

	public:
		MiningAlgorithmClassAttribute(System::Type^ algorithmClass )
		{
			if( algorithmClass == nullptr )
				throw gcnew System::Exception("MiningAlgorithmClassAttribute -- the algorithm class is invalid");

			this->algorithmClass = algorithmClass;
		}

		property System::Type^ AlgorithmClass
		{
			System::Type^ get(){ return  algorithmClass; }
		}
	};


	// Attribute describing a mining function
	// It covers:
	//		description	-- mandatory, but it can be empty
	//		help file -- optional
	//		help context -- optional
	[AttributeUsage(AttributeTargets::Method)]
	public ref class MiningFunctionAttribute sealed  : public System::Attribute 
	{
	private:
		String^	m_description;
		String^	m_helpFile;
		long	m_helpContext;
	public:
		MiningFunctionAttribute(String^ description)
		{
			m_helpContext = -1;
			m_helpFile = nullptr;
			m_description = description;
		}

		MiningFunctionAttribute()
		{
			m_helpContext = -1;
			m_helpFile = nullptr;
			m_description = nullptr;
		}

		property String^	Description
		{
			String^ get()
			{
				return m_description;
			}
		}

		property String^	HelpFile
		{
			String^ get()
			{
				return m_helpFile;
			}
			void set(String^ value)
			{
				m_helpFile = value;
			}
		}

		property long	HelpContext
		{
			long get()
			{
				return m_helpContext;
			}
			void set(long value)
			{
				m_helpContext = value;
			}
		}

	};

	// use to distinguish between a Const and a Scalar col ref parameter
	[AttributeUsage(AttributeTargets::Parameter)]
	public ref class MiningScalarColumnRefAttribute sealed: public System::Attribute  
	{

	public:
		MiningScalarColumnRefAttribute()
		{
		}

	};

	// used to mark a DataTable parameter as a table col ref. Optional
	[AttributeUsage(AttributeTargets::Parameter)]
	public ref class MiningTableColumnRefAttribute sealed : public System::Attribute
	{

	public:
		MiningTableColumnRefAttribute()
		{
		}

	};


	// used to mark a boolean parameter as a Flag in a custom 
	// function

	[AttributeUsage(AttributeTargets::Parameter)]
	public ref class FlagAttribute sealed : public System::Attribute
	{

	public:
		FlagAttribute()
		{
		}

	};
}
}
}
}